from django.shortcuts import render

# Create your views here.
from rest_framework.viewsets import ModelViewSet
# from rest_framework.views import APIView
from rest_framework.response import Response
from rest_framework.permissions import AllowAny
from .models import Books, Publish, Auther
from .serializer import BookSerializer, PublishSerializer, AutherSerializer
from .custom import CustomViewSet, MyPageNumberPagination

class BooksViewSet(CustomViewSet):
    permission_classes = (AllowAny,)
    queryset = Books.objects.all()
    serializer_class = BookSerializer
    pagination_class = MyPageNumberPagination

class PublishViewSet(CustomViewSet):
    permission_classes = (AllowAny,)
    queryset = Publish.objects.all()
    serializer_class = PublishSerializer

class AutherViewSet(CustomViewSet):
    permission_classes = (AllowAny,)
    queryset = Auther.objects.all()
    serializer_class = AutherSerializer